package com.samphanie.dries.domain.dto;

import com.samphanie.dries.annotation.PasswordMatch;
import com.samphanie.dries.annotation.ValidEmail;
import com.samphanie.dries.annotation.ValidPassword;
import com.samphanie.dries.util.Constants;
import lombok.Data;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * @Description:
 * @Author ZSY
 * @createTime 2021/2/25 14:13
 */
@Data
@PasswordMatch
public class UserDto implements Serializable {

    @NotNull
    @NotBlank
    @Size(min = 3, max = 50, message = "用户名长度必须在4到50个字符之间")
    private String username;

    @NotNull
    @ValidPassword
    private String password;
    private String matchPassword;

    @NotNull
    @ValidEmail
    @Size(min = 1)
    private String email;

    @NotNull
    @NotBlank
    @Size(min = 1, max = 10, message = "昵称长度必须在2到10个字符之间")
    private String nickname;

    @Pattern(regexp = Constants.PATTERN_MOBILE)
    @NotNull
    private String mobile;

//    @Positive(message = "年龄必须在1到120岁之间") // 验证是否为正数（不包括0）
//    @Max(value = 120, message = "年龄必须在1到120之间")
//    private Integer age;

}
